package com.yueka.mapper;

import com.yueka.pojo.teacher.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface TeacherMapper {
    Integer insert(Teacher teacher);

    List<Teacher> list(String keyword, String status);
    @Update("update teacher set teacher.teacher_name = #{teacherName},gender = #{gender}, age = #{age}, phone = #{phone}, level = #{level}, email = #{email}, address = #{address}, status = #{status}, avatar = #{avatar}, description = #{description}, join_date = #{joinDate}, update_time = #{updateTime} where id = #{id}")
    void update(Teacher teacher);

    void delete(Integer[] ids);

    @Select("select id, teacher_name, gender, age, phone, level, email, address, status, avatar, join_date, description, update_time, create_time, (select GROUP_CONCAT(ic_name) from instrument_category where id in (select i_id from teacher_instrument where t_id = teacher.id)) as instrumentNames from teacher where status = '1'")
    List<Teacher> getTeacherList();
}
